import java.util.*;
import java.io.*;
class tst extends Object
{
    int x;
    public tst(int i){
        x = i;
    }
    protected void finalize() throws java.lang.Throwable{
        super.finalize();
        System.out.println("finalize is called");
        
    }    
}
public class Test
{
    public static void main (String [] args) throws IOException
    {
        System.out.println("hello java");
        String str;
        str = String.format("%s","args");
        System.out.println(str);
        char [] helloarray = {'h','e','l','l','o','.'};
        String hellostring = new String(helloarray);
        System.out.println(hellostring);
        System.out.println("string length: " + hellostring.length());
        System.out.println("my name is ".concat("suse"));
        System.out.println("my name is "+"suse");
        
        StringBuffer sbuf = new StringBuffer("test ");
        sbuf.append("sbuffer");
        System.out.println(sbuf);
        System.out.println(sbuf.capacity());
        
        int [] chs={1,2,3,4,5};
        System.out.println("array length ="+chs.length);
        for (int elem:chs){
            System.out.println(elem+' ');
        }
        for (int elem:reverse(chs)){
            System.out.println(elem+' ');
        }
        tst tstobj = new tst(2);
        System.out.println(tstobj.x);
        
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        char c;
        do {
            c = (char) br.read();
            System.out.println(c);
        }while(c != 'q');
        
        
        do {
            str = br.readLine();
            System.out.println(str);
        }while(!str.equals("end"));
        System.gc();
    }   

    public static int [] reverse(int [] list)
    {
        int [] result = new int[list.length];
        for (int i=0,j = result.length -1;i<result.length; i++,j--){
            result[j]=list[i];
        }
        return result;
    }
}
//javac  "$(FULL_CURRENT_PATH)" && java -cp "$(CURRENT_DIRECTORY)" "$(NAME_PART)"